import java.sql.Time;

/**
 * Clock keeps track of ticks Author: Kyle Van Wie Version v1.2 v1 Initial
 * Version v1.2 Add getTime() v1.3 Add checkTick()
 */
public class Clock {
	Time time;
	int tickLength = 1;
	long startTime = 0;

	public Clock() {
		tickLength = 1;
		startTime = System.currentTimeMillis();
		time = new Time(0);
	}

	public Clock(int _tickLength) {
		tickLength = _tickLength;
		startTime = System.currentTimeMillis();
		time = new Time(0);
	}

	public long getTick() {
		return (System.currentTimeMillis() - startTime) / (tickLength * 1000);
	}

	public Time getTime() {
		time.setTime(System.currentTimeMillis());
		return time;
	}

	public boolean checkTick(long TimeStamp, int Duration) {
		if (getTick() - TimeStamp >= Duration) {
			return true;
		}
		return false;
	}
}